Skip to content

nmc: P1 PE 2b-ii — pin NMC P2P network magic SSOT (f9beb4fe/fabfb5fe) - #239

Merged
frstrtr merged 1 commit into
masterfrom
nmc/p1-pe-2b-ii-magic-ssot
Jun 19, 2026
Merged

nmc: P1 PE 2b-ii — pin NMC P2P network magic SSOT (f9beb4fe/fabfb5fe)#239
frstrtr merged 1 commit into
masterfrom
nmc/p1-pe-2b-ii-magic-ssot

Conversation

@frstrtr

@frstrtr frstrtr commented Jun 19, 2026

Copy link
Copy Markdown
Owner

P1 PE 2b-ii — NMC P2P network-magic SSOT

Adds NMCChainParams::p2p_magic (4-byte pchMessageStart), the frame prefix every parent-NMC P2P message carries. The embedded won-block broadcaster (PE) needs it to talk the NMC wire protocol — a wrong/zero magic makes namecoind drop the peer on EOF before the handshake completes (the failure main_bch.cpp:138 documents for BCH).

Values — sourced, not from memory

From genuine upstream namecoin-core src/kernel/chainparams.cpp pchMessageStart (the same source chain_seeds.hpp cites):

Magic is a published network constant (no daemon re-derivation needed), distinct from the genesis hash. Mainnet GENESIS stays TO-CONFIRM pending a mainnet namecoind.

Test

New NmcP1Genesis.P2PMagicPinned KAT asserts both magics + their inequality (net-isolation primitive). Rides the allowlisted nmc_auxpow_wire_test exe → no build.yml change. Local build + run: 4/4 PASS, exit 0.

Fence

src/impl/nmc/ only (header_chain.hpp + auxpow_wire_test.cpp). Own-coin-tree, non-consensus, no shared-host file → auto-merge-eligible class.

Follow-on

Host get_chain_p2p_prefix table currently returns {} (P2P broadcast disabled) for NMC; a follow-on host wire slice references this SSOT (shared-host hunk → operator-tap, like 2b-i #238). Cut off origin/master per the slice-base rule (NOT stacked on #238).

Add NMCChainParams::p2p_magic (4-byte pchMessageStart), the frame prefix
every parent-NMC P2P message carries. The embedded won-block broadcaster
(PE) needs it to talk the NMC wire protocol; a wrong/zero magic makes
namecoind drop the peer on EOF before the handshake completes (the failure
main_bch.cpp:138 documents for BCH).

Values sourced from namecoin-core src/kernel/chainparams.cpp pchMessageStart,
NOT from memory:
  mainnet  CMainParams    = f9 be b4 fe
  testnet3 CTestNetParams = fa bf b5 fe  (pairs with the testnet3 genesis
                                          time=1296688602 pinned in 2b-0)

New NmcP1Genesis.P2PMagicPinned KAT asserts both magics + their inequality
(net-isolation primitive). Rides the allowlisted nmc_auxpow_wire_test exe
-> no build.yml change. SSOT for a follow-on host get_chain_p2p_prefix wire
slice (shared-host hunk, operator-tap). Mainnet GENESIS stays TO-CONFIRM
pending a mainnet namecoind; magic is a published network constant.

Fence: src/impl/nmc/ only.
@frstrtr
frstrtr merged commit 9f06128 into master Jun 19, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant